home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Games 1996 July
/
Amiga Games 1996 #7.iso
/
archive
/
userbox
/
publicdomain
/
muispell.lha
/
MUISpell
/
Source
/
Main.c
< prev
Wrap
C/C++ Source or Header
|
1996-03-28
|
4KB
|
133 lines
/***************************************************************************
* *
* MUISpell *
* Spellchecking without texteditor, requires AlphaSpell and MUI *
* Copyright (C) 1996 Dirk Holtwick *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
* *
* Author: Dirk Holtwick *
* Karlstr. 59 *
* 47119 Duisburg *
* GERMANY *
* dirco@uni-duisburg.de *
* *
****************************************************************************/
// This sourcecode has been translated by the MaxonC++ Compiler
// The program has been written for MUI2.3 and I didn't change
// it until now, but be aware that the var MUIMASTER_VMIN is
// used in this source, so it depends on the includes that you
// use, with wich MUI version your program may be used.
#define WBWINNAME "con:20/20/300/100/ERRORS/close/auto/wait"
#include <wbstartup.h>
#include <workbench/workbench.h>
#include <pragma/muimaster_lib.h>
#include <pragma/exec_lib.h>
#include <pragma/asl_lib.h>
#include <pragma/dos_lib.h>
#include <pragma/icon_lib.h>
#include <clib/alib_protos.h>
#include <libraries/mui.h>
#include <exec/memory.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <ctype.h>
struct Library * LocaleBase=0;
struct Library * MUIMasterBase;
struct ObjApp * App = NULL;
struct FileRequester *fr;
// KATALOGFUNKTIONEN BEKANNT MACHEN
extern void OpenMUISpellCatalog(struct Locale *, STRPTR);
extern void CloseMUISpellCatalog(void);
extern STRPTR GetMUISpellString(LONG);
// DIE EIGENEN INCLUDES
#include "gui.h"
#include "cat.h"
#include "hooks.c"
// UEBERNOMMEN VON MUI
static void init( void ){
if (!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN))){
printf("Can't Open MUIMaster Library");
exit(20);
}
}
// HAUPTPROGRAMM
void main(){
BOOL running = TRUE;
ULONG signal,*d,*b;
init();
LocaleBase = OpenLibrary("locale.library", 38);
OpenMUISpellCatalog(NULL, NULL);
if(fr=MUI_AllocAslRequestTags (
ASL_FileRequest,
TAG_DONE
)){
App = CreateApp();
DoMethod(App->App,MUIM_Application_Load,MUIV_Application_Load_ENV);
do_editdist();
while (running){
switch(DoMethod(App->App,MUIM_Application_Input,&signal)){
case MUIV_Application_ReturnID_Quit:
if(!chok()) break;
if(learned && ramdict){
if(MUI_RequestA (
App->App,App->win_view,0,NULL,
GetMUISpellString(m_reqbt_learned),GetMUISpellString(m_req_learned),0
)){
get(App->str_drawer, MUIA_String_Contents, &d);
get(App->str_user, MUIA_String_Contents, &b);
sprintf(command,"c:copy \"ram:%s.mix\" \"ram:%s.low\" \"ram:%s.ldx\" \"ram:%s.mdx\" to \"%s\"",b,b,b,b,d);
Ex(command);
}
}
running=FALSE;
break;
}
if (running && signal) Wait(signal);
};
MUI_FreeAslRequest(fr);
DisposeApp(App);
}else puts("Konnte ASL-Requester nicht öffnen");
CloseMUISpellCatalog();
if (LocaleBase != NULL) CloseLibrary(LocaleBase);
CloseLibrary(MUIMasterBase);
DeleteFile ("t:text.cor");
DeleteFile ("t:text.sug");
freeall();
exit(0);
}